"""
3-Axis Accelerometer QMA6100P sensor driver.
"""

from usr.libs.i2c import I2CIOWrapper


# QMA6100P register addresses
QMA6100P_CHIP_ID = b"\x00"


class Qma6100p(I2CIOWrapper):
    
    def getChipId(self):
        return self.read(QMA6100P_CHIP_ID, 1)[0]


if __name__ == "__main__":
    from machine import I2C

    qma6100p_dev = Qma6100p(I2C(I2C.I2C0, I2C.STANDARD_MODE), 0x12)
    print("qma6100p chip id: 0x{:X}".format(qma6100p_dev.getChipId()))
